package com.demo.ssm.controller;

import com.alibaba.fastjson.JSON;
import com.demo.ssm.pojo.Admin;
import com.demo.ssm.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author wangms
 * @since 2022/4/23 12:51
 */
@Controller
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    private AdminService adminService;

    @GetMapping("/getOneAdmin")
    public String test(Model model) {
        Admin admin = adminService.getOneAdmin();
        System.out.println(JSON.toJSONString(admin));
        model.addAttribute("admin", admin);
        return "t";
    }
}
